package com.imti.mall.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.imti.mall.model.pms.pojo.PmsProductFullReduction;
import com.imti.mall.model.pms.pojo.PmsProductLadder;
import com.imti.mall.product.dao.PmsProductFullReductionDao;
import com.imti.mall.product.dao.PmsProductLadderDao;
import com.imti.mall.product.service.PmsProductFullReductionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PmsProductFullReductionServiceImpl extends ServiceImpl<PmsProductFullReductionDao, PmsProductFullReduction> implements PmsProductFullReductionService {
    @Autowired
    PmsProductFullReductionDao pmsProductFullReductionDao;
    /**
     * 根据商品id查询商品满减表
     * @param id
     * @return
     */
    @Override
    public List<PmsProductFullReduction> getPmsProductFullReductionId(Integer id) {
        return pmsProductFullReductionDao.getPmsProductFullReductionId(id);
    }
    /**
     * 根据满减表表id修改满减表
     * @param pmsProductFullReduction
     * @return
     */
    @Override
    public Integer upadtePmsProductFullReduction(PmsProductFullReduction pmsProductFullReduction) {
        return pmsProductFullReductionDao.updatePmsProductLadder(pmsProductFullReduction);
    }
    /**
     * 查询全部商品满减表价格表
     * @return
     */
    @Override
    public List<PmsProductFullReduction> findPmsProductFullReduction() {
        return pmsProductFullReductionDao.selectList(null);
    }
    /**
     * 根据id查询商品满减表格表
     * @return
     */
    @Override
    public PmsProductFullReduction findPmsProductFullReductionById(Integer id) {
        return pmsProductFullReductionDao.selectById(id);
    }
    /**
     * 添加商品满减表价格表
     * @return
     */
    @Override
    public Integer addPmsProductFullReduction(PmsProductFullReduction pmsProductFullReduction) {
        return pmsProductFullReductionDao.insert(pmsProductFullReduction);
    }
    /**
     * 根据商品满减表价格表id删除
     * @return
     */
    @Override
    public Integer delPmsProductLadder(Integer id) {
        return pmsProductFullReductionDao.deleteById(id);
    }

    @Override
    public boolean addList(List<PmsProductFullReduction> list) {
        return saveBatch(list);
    }

    @Override
    public boolean updateList(List<PmsProductFullReduction> list) {
        return saveOrUpdateBatch(list);
    }

    @Override
    public boolean deleteList(List<PmsProductFullReduction> list) {
        return removeByIds(list);
    }
}
